import 'package:json_annotation/json_annotation.dart';

part 'address.g.dart';

@JsonSerializable()
class Address {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'phone')
  String phone;

  @JsonKey(name: 'sendee')
  String sendee;

  @JsonKey(name: 'province_id')
  int provinceId;

  @JsonKey(name: 'province')
  String province;

  @JsonKey(name: 'city_id')
  int cityId;

  @JsonKey(name: 'city')
  String city;

  @JsonKey(name: 'district_id')
  int districtId;

  @JsonKey(name: 'district')
  String district;

  @JsonKey(name: 'address')
  String address;

  @JsonKey(name: 'is_default')
  bool isDefault;

  Address(
    this.id,
    this.phone,
    this.sendee,
    this.provinceId,
    this.province,
    this.cityId,
    this.city,
    this.districtId,
    this.district,
    this.address,
    this.isDefault,
  );

  factory Address.fromJson(Map<String, dynamic> srcJson) =>
      _$AddressFromJson(srcJson);

  Map<String, dynamic> toJson() {
    return _$AddressToJson(this);
  }
}
